package com.czp.job.mapper.impl;

import java.util.List;

import org.apache.ibatis.session.RowBounds;

import com.czp.framework.mapper.BaseMapperSupport;
import com.czp.job.mapper.IJobMapper;
import com.czp.job.model.Job;
import com.czp.job.model.RelationJob;
import com.czp.job.model.RelationPerson;

/**
 * 【环 境】：J2SE 1.7
 * @author   柴志鹏	CHAIZP@GMAIL.COM
 * @version  version 1.0
 * @since    2014-7-17
 */
public class JobMapperImpl extends BaseMapperSupport implements IJobMapper {
	
	public List<Job> queryJobList(Job job, RowBounds bounds) throws Exception {
		return this.getSqlSession().selectList(
				"com.czp.job.mapper.IJobMapper.queryJobList", job, bounds);
	}
	
	public int getJobRecords(Job job) throws Exception {
		return this.getSqlSession().selectOne(
				"com.czp.job.mapper.IJobMapper.getJobRecords", job);
	}

	public int insertJob(Job job) throws Exception {
		return this.getSqlSession().insert(
				"com.czp.job.mapper.IJobMapper.insertJob", job);
	}
	
	public int updateJob(Job job) throws Exception {
		return this.getSqlSession().update(
				"com.czp.job.mapper.IJobMapper.updateJob", job);
	}
	
	public int deleteJob(Job job) throws Exception {
		return this.getSqlSession().update(
				"com.czp.job.mapper.IJobMapper.deleteJob", job);
	}

	public List<RelationJob> querySubordinateByJobId(String jobId) throws Exception {
		return this.getSqlSession().selectList(
				"com.czp.job.mapper.IJobMapper.querySubordinateByJobId", jobId);
	}

	public List<RelationPerson> queryPersonByJobId(String jobId) throws Exception {
		return this.getSqlSession().selectList(
				"com.czp.job.mapper.IJobMapper.queryPersonByJobId", jobId);
	}
	
	public int deleteRelationJob(RelationJob relJob) throws Exception {
		return this.getSqlSession().delete(
				"com.czp.job.mapper.IJobMapper.deleteRelationJob", relJob);
	}
	
	public int deleteRelationPerson(RelationPerson relPerson) throws Exception {
		return this.getSqlSession().delete(
				"com.czp.job.mapper.IJobMapper.deleteRelationPerson", relPerson);
	}
	
	public List<RelationPerson> getSelectedPersonList(RelationPerson relPerson) throws Exception {
		return this.getSqlSession().selectList(
				"com.czp.job.mapper.IJobMapper.getSelectedPersonList", relPerson);
	}
	
	public int getSelectedPersonCount(RelationPerson relPerson) throws Exception {
		return this.getSqlSession().selectOne(
				"com.czp.job.mapper.IJobMapper.getSelectedPersonCount", relPerson);
	}
	
	public int matchAddRelationPerson(RelationPerson relPerson) throws Exception {
		return this.getSqlSession().selectOne(
				"com.czp.job.mapper.IJobMapper.matchAddRelationPerson", relPerson);
	}
	
	public int insertRelationPerson(RelationPerson relPerson) throws Exception {
		return this.getSqlSession().insert(
				"com.czp.job.mapper.IJobMapper.insertRelationPerson", relPerson);
	}
	
	public List<Job> getOptionalJob(String jobId) throws Exception {
		return this.getSqlSession().selectList(
				"com.czp.job.mapper.IJobMapper.getOptionalJob", jobId);
	}
	
	public List<Job> getSelectedJob(String jobId) throws Exception {
		return this.getSqlSession().selectList(
				"com.czp.job.mapper.IJobMapper.getSelectedJob", jobId);
	}
	
	public int insertRelationJob(RelationJob relJob) throws Exception {
		return this.getSqlSession().insert(
				"com.czp.job.mapper.IJobMapper.insertRelationJob", relJob);
	}
	
	public int matchAddRelationJob(RelationJob relJob) throws Exception {
		return this.getSqlSession().selectOne(
				"com.czp.job.mapper.IJobMapper.matchAddRelationJob", relJob);
	}
	
	public int deleteRelationJobItemSelect(RelationJob relJob) throws Exception {
		return this.getSqlSession().delete(
				"com.czp.job.mapper.IJobMapper.deleteRelationJobItemSelect", relJob);
	}
	
}
